package com.wd.mylibrary_list.activity.fragment

import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
import com.wd.mylibrary_base.bean.FindLeaderBoardBean
import com.wd.mylibrary_base.utils.HttpUtils
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.schedulers.Schedulers

/**
 * 作者： 袁春杰
 * 日期： 2024/9/23 19:41
 * 功能：
 */
class LIstViewModel:ViewModel() {
    val findLeaderBoardData= MutableLiveData<FindLeaderBoardBean>()
    //tab下标切换状态监听
    val tabPositionIndex= MutableLiveData<Int>()
    fun tabPosition(id:Int){
        tabPositionIndex.value=id
    }
    fun getFindLeaderBoard(){
        HttpUtils.httpUtils.apiService.getFindLeaderBoardData()
            .subscribeOn(Schedulers.io())
            .observeOn(AndroidSchedulers.mainThread())
            .subscribe {
                findLeaderBoardData.value=it
            }
    }
}